home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / hc / hyperps1.sit / HyperPS 1.2 / card_3409.txt < prev    next >
Text File  |  1988-11-14  |  3KB  |  116 lines

  1. -- card: 3409 from stack: in.2
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 2562
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 1
  9. ----- text -----
  10. gsave initmatrix
  11.  
  12. %!PS-Adobe-1.0
  13. %%Creator: Erik Reinecke
  14. %%Title: PostScript Arrives
  15. %%CreationDate:11/15/85 
  16. %%Pages:1
  17. %%DocumentFonts: Helvetica-BoldOblique
  18. %%Dimensions:0 0 612 792
  19. %%EndComments
  20.  
  21.  
  22. % Simulate a plane with log spaced lines. Expects these parameters:
  23. % x dimension, y dimension, number of lines to horizon, width of 
  24. % first line and shade of gray for background.
  25.  
  26. /Horizon                  
  27.    { /grayshade exch def              % shade of gray  
  28.      /firstline exch def              % linewidth in foreground
  29.      /nlines exch def                 % number of lines in plain
  30.      /dy exch def                     % y dimension
  31.      /dx exch def                     % x dimension
  32.  
  33.       newpath 0 0 moveto              % draw plain in gray
  34.       0 dy rlineto
  35.       dx 0 rlineto
  36.       0 0 dy sub rlineto
  37.       closepath  
  38.       grayshade setgray
  39.       fill
  40.       
  41.       0 setgray                % black lines
  42.       1 10 nlines div 10       % for loop (1 to 10)
  43.        {dup                    % save a copy of loopcounter
  44.         truncate firstline exch div % make line thinner as it recedes
  45.         setlinewidth
  46.         log dy mul             % log(loopcounter) times y dimension
  47.         0 exch moveto
  48.         dx 0 rlineto
  49.         stroke                 % draw the line
  50.        } for
  51.    } def                       % end horizon
  52.  
  53.  
  54.  
  55. /PostScript
  56.   {/GrayValue exch def
  57.    /Fontsize exch def 
  58.    /Helvetica-BoldOblique findfont Fontsize scalefont setfont
  59.    0 0 moveto
  60.    (PostScript) true charpath
  61.     gsave
  62.         GrayValue setgray fill
  63.     grestore
  64.     0.7 setlinewidth
  65.     stroke
  66.    } def
  67.  
  68. /IsHere
  69.   {/GrayValue exch def
  70.    /Fontsize exch def 
  71.    /Helvetica-BoldOblique findfont Fontsize scalefont setfont
  72.    0 0 moveto
  73.    (is here!) true charpath
  74.     gsave
  75.         GrayValue setgray fill
  76.     grestore
  77.     0.7 setlinewidth
  78.     stroke
  79.    } def
  80.  
  81. /sphere                         % draw a 'sphere' by shading from
  82.    {                            % white in the middle to black at 
  83.     1 1 90                      % the edges using cos function.
  84.      { 0 0 2 index 0 360 arc    % Circle using 0,0 as center and
  85.                                 % loop index as radius.
  86.        cos setgray              % cos(loopindex) is used to setgray
  87.        stroke                   % draw it
  88.       } for                     % end for 1 to 90 
  89.     } def                       % end sphere
  90.  
  91. 306 391 translate
  92. 90 rotate
  93. -406 -391 translate
  94.  
  95. gsave
  96. 150 580 translate
  97. .5 .5 scale
  98. sphere
  99. grestore
  100. gsave
  101. 792 450 50 5 .85 Horizon
  102. grestore
  103. 250 250 translate
  104. gsave
  105. [1 0.3249 1 -1 0 0] concat           % skew axes for shadow
  106. 50 0 PostScript
  107. grestore
  108. gsave
  109. [1 0.3249 0 1 0 0] concat
  110. 50 .5 PostScript
  111. grestore
  112. 300 -42 translate
  113. 27 1 IsHere
  114.  
  115. grestore
  116.